<?php

namespace app\validate;

use think\Validate;

class OrderValidate extends Validate
{
    protected $rule = [
        'id' => 'require',
        'product_type' => 'require|in:100,200',
        'dingdan_code' => 'require',
        'dingdan_date' => 'require',
        'product_name' => 'require',
        'customer_id' => 'require',
        'quantity' => 'require',
        'delivery_date' => 'require',
        'bom' => 'require|array',
        'user_status' => 'require|in:300,400',
        'approval_user_id'=>'require'
    ];


    protected $message = [
        'product_type.require' => '请选择产品类型',
        'product_type.in' => '请选择正确的产品类型',
        'dingdan_code.require' => '请输入订单编号',
        'dingdan_date.require' => '请输入订单日期',
        'product_name.require' => '请输入产品名称',
        'customer_id.require' => '请选择客户',
        'quantity.require' => '请输入数量',
        'delivery_date.require' => '请输入交货日期',
        'bom.require' => '请选择BOM',
        'user_status.require' => '请选择审批状态',
        'user_status.in' => '请选择正确的审批状态',
        'approval_user_id.require' => '请选择审批节点'
    ];


    protected $scene = [
        'add' => ['product_type', 'dingdan_code', 'dingdan_date', 'product_name', 'customer_id', 'quantity',
            'delivery_date', 'bom'],
        'edit' => ['id', 'product_type', 'dingdan_code', 'dingdan_date', 'product_name', 'customer_id', 'quantity',
            'delivery_date', 'bom'],
        'info' => ['id'],
        'initiateApproval' => ['id'],
        'submitApproval' => ['approval_user_id', 'user_status'],
        'updateTechnicalRequirements' => ['id'],
        'bomList'=>['id'],
        'createCgOrder'=>['id'],
    ];
}